<?php
namespace backend\modules\guild;

use Yii;
use yii\base\Module;

/**
 * guild module definition class
 */
class GuildModule extends Module
{
    /**
     * @inheritdoc
     */
    public $controllerNamespace = 'backend\modules\guild\controllers';

    /**
     * @inheritdoc
     */
    public function init()
    {
        parent::init();
        $this->registerTranslations();
    }

    public function registerTranslations()
    {
        Yii::$app->i18n->translations['modules/guild/*'] = [
            'class' => 'yii\i18n\PhpMessageSource',
            'basePath' => '@app/modules/guild/messages',
            'fileMap' => [
                'modules/guild/default' => 'default.php'
            ]
        ];
    }

    public static function t($category, $message, $params = [], $language = null)
    {
        return Yii::t('modules/guild/' . $category, $message, $params, $language);
    }
}
